package com.zhang.memento.black_box;



public class Client {
    public static void main(String[] args) {
        System.out.println("------------大战boss前------------");
        //创建游戏角色对象
        GameRole gameRole = new GameRole();
        gameRole.initState();//初始状态操作

        gameRole.stateDisplay();

        //将该游戏角色状态进行备份
        RoleStateCaretaker caretaker = new RoleStateCaretaker();
        caretaker.setMemento(gameRole.saveState());

        System.out.println("------------大战boss后------------");
        //损耗严重
        gameRole.fight();

        gameRole.stateDisplay();
        System.out.println("-----------恢复之后的状态----------");
        gameRole.recoverState(caretaker.getMemento());
        gameRole.stateDisplay();
    }
}
